package com.itheima.Test01.edu.info.manager.teacher.service;

import com.itheima.Test01.edu.info.manager.teacher.dao.StudentDao;
import com.itheima.Test01.edu.info.manager.teacher.domain.Student;

public class StudentSercice {
    public static boolean addStudent(Student stu) {
        boolean flag = StudentDao.addStudent(stu);
        return flag;
    }

    public static boolean isExists(String id) {
        boolean exe = StudentDao.isExists(id);
        return exe;
    }

    public static Student[] QueryStudent() {
        Student[] stu = StudentDao.QueryStudent();
        boolean flag = false;
        for (int i = 0; i < stu.length; i++) {
            if (stu[i] != null) {
                flag = true;
                break;
            }
        }
        if (flag){
            return stu;
        }else {
            return null;
        }
    }

    public static void deletStudent(String id) {
        StudentDao.delentStudent(id);
    }

    public static void updateStudent(Student stu,String id) {
        StudentDao.updateStudent(stu,id);
    }
}
